package org.ljdp.bootstrap.loader;

import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;

import org.ljdp.bootstrap.LoaderUtil;

/**
 * 系统需要的jar放在lib目录下载入
 * @author hzy
 *
 */
public class ExtLibLoader {
	private String currPath;

	public ExtLibLoader(String currPath) {
		super();
		this.currPath = currPath;
	}
	
	public void doLoadClass() throws MalformedURLException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
		int lastIndex = currPath.lastIndexOf(File.separator);
		String procPath = currPath.substring(0, lastIndex);
		
		List<URL> urls = LoaderUtil.buildJarModelURL(procPath);//使用jar模式运行的类载入路径
		LoaderUtil.addClasses(urls);
	}
}
